﻿<Window x:Class="Notoric.Gui.Windows.PageAppearanceDialog"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        xmlns:ls="clr-namespace:LukasKopenec.LocalizationSupport;assembly=LocalizationSupport"
        xmlns:rb="clr-namespace:Fluent;assembly=Fluent"
        xmlns:cvr="clr-namespace:Notoric.ViewModel.Converters;assembly=ViewModel"
        DataContext="{Binding RelativeSource={RelativeSource Self}}"
        Title="{ls:Localize Ribbon.CommandTitles.PageAppearance}" Height="300" Width="330"
        Loaded="Window_Loaded" Background="#FFF0F0F0" ResizeMode="NoResize" WindowStartupLocation="CenterScreen">
    <Window.Resources>
        <cvr:LengthConverter x:Key="lengthConverter" SwitchConversionDirection="True"/>
    </Window.Resources>
    <StackPanel>
    <StackPanel Orientation="Vertical" Background="White" Margin="7 7 7 0">
        <GroupBox Header="{ls:Localize Windows.PageAppearanceDialog.PaperFormat}">
            <StackPanel Orientation="Vertical">
                <rb:Spinner x:Name="PART_Width" Format="0.00 cm" Maximum="50" Minimum="0.25" Text="{ls:Localize Windows.PageAppearanceDialog.Width}" 
                            Value="{Binding Page.Width,Converter={StaticResource lengthConverter},Mode=TwoWay}"/>
                <rb:Spinner x:Name="PART_Height" Grid.Row="1" Grid.Column="1" Format="0.00 cm" Maximum="50" Minimum="0.25" Text="{ls:Localize Windows.PageAppearanceDialog.Height}"
                            Value="{Binding Page.Height,Converter={StaticResource lengthConverter},Mode=TwoWay}"/>
            </StackPanel>
        </GroupBox>
        <GroupBox Header="{ls:Localize Windows.PageAppearanceDialog.Margin}">
            <Grid>
                <Grid.RowDefinitions>
                    <RowDefinition/>
                    <RowDefinition/>
                </Grid.RowDefinitions>
                <Grid.ColumnDefinitions>
                    <ColumnDefinition/>
                    <ColumnDefinition/>
                </Grid.ColumnDefinitions>
                <rb:Spinner x:Name="PART_TopMargin" Grid.Row="0" Grid.Column="0" Text="{ls:Localize Windows.PageAppearanceDialog.Top}" Format="0.00 cm"
                            Maximum="50" Minimum="0" Increment="0.1"/>
                <rb:Spinner x:Name="PART_LeftMargin" Grid.Row="1" Grid.Column="0" Text="{ls:Localize Windows.PageAppearanceDialog.Left}" Format="0.00 cm"
                            Maximum="50" Minimum="0" Increment="0.1"/>
                <rb:Spinner x:Name="PART_BottomMargin" Grid.Row="0" Grid.Column="1" Text="{ls:Localize Windows.PageAppearanceDialog.Bottom}" Format="0.00 cm"
                            Maximum="50" Minimum="0" Increment="0.1"/>
                <rb:Spinner x:Name="PART_RightMargin" Grid.Row="1" Grid.Column="1" Text="{ls:Localize Windows.PageAppearanceDialog.Right}" Format="0.00 cm"
                            Maximum="50" Minimum="0" Increment="0.1"/>
            </Grid>
        </GroupBox>
        <GroupBox Header="{ls:Localize Windows.PageAppearanceDialog.Orientation}">
            <StackPanel Orientation="Horizontal" HorizontalAlignment="Center">
                <ToggleButton x:Name="PART_Portrait" Background="White" Checked="PART_Portrait_Checked">
                    <StackPanel Orientation="Vertical">
                        <Image Source="../Resources/Images/Ribbon/Large/Portrait.png"/>
                        <TextBlock Text="{ls:Localize Ribbon.CommandTitles.PageAppearance.Orientation.Portrait}" HorizontalAlignment="Center" />
                    </StackPanel>
                </ToggleButton>
                <ToggleButton x:Name="PART_Landscape" Background="White" Margin="4 0 0 0" Checked="PART_Landscape_Checked">
                    <StackPanel Orientation="Vertical">
                        <Image Source="../Resources/Images/Ribbon/Large/Landscape.png"/>
                        <TextBlock Text="{ls:Localize Ribbon.CommandTitles.PageAppearance.Orientation.Landscape}" HorizontalAlignment="Center" />
                    </StackPanel>
                </ToggleButton>
            </StackPanel>
        </GroupBox>
    </StackPanel>
        <StackPanel Orientation="Horizontal" HorizontalAlignment="Right" Margin="0 10 7 0">
            <Button x:Name="PART_OK" Content="{ls:Localize Windows.OKButton}" Width="60" IsDefault="True" Click="PART_OK_Click" />
            <Button x:Name="PART_Cancel" Content="{ls:Localize Windows.CancelButton}" Margin="6 0 0 0" Width="60" IsCancel="True" Click="PART_Cancel_Click" />
        </StackPanel>
    </StackPanel>
</Window>
